package com.example.shop_2207.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.shop_2207.R
import com.example.shop_2207.entity.CategoryEntity
import com.example.shop_2207.net.GlideUtils

class CategoryAdapter(list: MutableList<CategoryEntity>):BaseQuickAdapter<CategoryEntity,BaseViewHolder>(R.layout.item_category,list) {
    override fun convert(holder: BaseViewHolder, item: CategoryEntity) {
        holder.setText(R.id.category_tv,item.category_name)//修改文本文字
        //Glide.with(context).load(item.category_icon).into(holder.getView(R.id.category_iv))//修改图片显示
        item.category_icon?.let {
            GlideUtils.loadCircleImage(context,
                it,holder.getView(R.id.category_iv))
        }
    }
}